﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace LetLord.Models
{
    [Table("Viewing")]
    public class Viewing
    {
        public Viewing()
        {
            this.Tenants = new List<Tenant>();
        }

        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int ViewingId { get; set; }
        public DateTime ViewingDate { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }

        // A Viewing can have many Tenants
       // [ForeignKey("UserId")]
        public virtual ICollection<Tenant> Tenants { get; set; }

        // A Viewing belongs to 1 ResidentialProperty
        public int ResidentialPropertyId { get; set; }
        public virtual ResidentialProperty ResidentialProperty { get; set; }

        // A viewing is created by 1 Landlord
        public int UserId { get; set; }
        [ForeignKey("UserId")]
        public virtual Landlord Landlord { get; set; }
    }
}